package edu.pku.sei.transformation.editor.controller.commands.link;

import edu.pku.sei.transformation.editor.model.execution.INode;
import edu.pku.sei.transformation.editor.model.execution.IObjectNode;
import edu.pku.sei.transformation.editor.model.execution.ObjectFlow;

public class ObjectFlowCreateCommand extends
		AbstractLinkCreateCommand<ObjectFlow, INode, INode> {
	public ObjectFlowCreateCommand(ObjectFlow link, INode source) {
		super(link, source);
	}
	
	@Override
	public void execute() {
		link.setSource(source);
		link.setTarget(target);
		source.getOutgoings().add(link);
		target.getIncomings().add(link);
	}
	
	@Override
	public void undo() {
		link.setSource(null);
		link.setTarget(null);
		source.getOutgoings().remove(link);
		target.getIncomings().remove(link);
	}
	


}
